<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <div id="test">
   <h2>显示格式化的日期时间</h2>
   <p>{{startTime | data-for}}</p>
   <p>{{startTime | data-for('HH:mm:ss')}}</p>
  </div>
  <script src="https://cdn.bootcdn.net/ajax/libs/dayjs/1.10.5/dayjs.min.js"></script>
  <script src="../js/vue.js"></script>
  <script>
     Vue.filter('data-for',(value,form='YYYY-MM-DD-HH:mm')=>{
        return dayjs(value).format(form)
     })
     new Vue({
       el:"#test",
        data:{
          startTime:Date.now()
        }
     })
  </script>
</body>
</html>